import gtk
#import gnomeapplet
import gobject
import re
underlineRe 	= re.compile( '(<u>|</u>)')

class MouseOverLabel(gtk.EventBox):
	def on_enter_cb(self,widget,event = None,data = None):
		name  = data
		t = underlineRe.sub('',name.get_label())
		name.set_markup("<u>%s</u>" % t)
		
	def on_leave_cb(self,widget,event = None,data = None):
		name  = data
		t = underlineRe.sub('',name.get_label())
		name.set_markup(t)
		
	def __init__(self):
		gtk.EventBox.__init__(self)
		l = gtk.Label()
		self.add(l)
		self.connect('enter-notify-event',self.on_enter_cb, l)
		self.connect('leave-notify-event',self.on_leave_cb, l)
		self.label = l
		self.set_visible_window(False)		
	def set_markup(self,markup):
		self.label.set_markup(markup)
		
	def set_alignment(self,x,y):
		self.label.set_alignment(x,y)
	def set_ellipsize(self,el):
		self.label.set_ellipsize(el)